/**  
* <p>Title: ParkingController.java</p >  
* <p>Description: </p >  
* <p>Company:luo.com</p >  
* @author 魏家洛 
* @date 2019年1月24日  
* @version 1.0  
*/  
package com.pmsystem.controller;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pmsystem.pojo.Parking;
import com.pmsystem.pojo.ZoneParking;
import com.pmsystem.service.FreeCarService;
import com.pmsystem.service.ParkingService;
import com.pmsystem.service.ZoneParkingService;

/**  
* <p>Title: ParkingController</p >  
* <p>Description: </p >  
* @author 魏家洛  
* @date 2019年1月24日  
*/
@Controller
@RequestMapping("parking")
public class ParkingController {
	@Autowired
	ParkingService parkingService;
	@Autowired
	FreeCarService freeCarService;
	@Autowired
	ZoneParkingService zoneParkingService;
	
	
	/**
	 * <p>Title: carIn</p >  
	 * <p>Description:登记车辆进入停车场</p >  
	 * @author 魏家洛
	 * @param parking
	 * @return
	 */
	@RequestMapping("carin")
	@ResponseBody
	public boolean carIn(Parking parking) {
		return parkingService.carIn(parking);
	}
	/**
	 * <p>Title: checkParking</p >  
	 * <p>Description:检查车牌号对应车是否在停车场内停车</p >  
	 * @author 魏家洛
	 * @param carlicense
	 * @return
	 */
	@RequestMapping("checkparking")
	@ResponseBody
	public boolean checkParking(String carlicense) {
		return parkingService.checkParking(carlicense);
	}
	/**
	 * <p>Title: billing</p >  
	 * <p>Description:车辆停车场计费</p >  
	 * @author 魏家洛
	 * @param carlicense
	 * @return
	 */
	@RequestMapping("billing")
	@ResponseBody
	public float billing(String carlicense,Date parkingEndTime) {
		return parkingService.billing(carlicense,parkingEndTime);
	}
	/**
	 * <p>Title: carOut</p >  
	 * <p>Description:车牌号对应车辆驶出停车场</p >  
	 * @author 魏家洛
	 * @param carlicense
	 * @return
	 */
	@RequestMapping("carout")
	@ResponseBody
	public boolean carOut(String carlicense) {
		return parkingService.carOut(carlicense);
	}
	/**
	 * <p>Title: remainSpace</p >  
	 * <p>Description:查找对应停车分区剩余车位</p >  
	 * @author 魏家洛
	 * @param parkingArea
	 * @return
	 */
	@RequestMapping("remainspace")
	@ResponseBody
	public int remainSpace(Integer parkingArea) {
		return parkingService.remainSpace(parkingArea);
	}
	/**
	 * <p>Title: getAllParkingArea</p >  
	 * <p>Description:获取所有停车分区信息</p >  
	 * @author 魏家洛
	 * @return
	 */
	@RequestMapping("getparkingarea")
	@ResponseBody
	public List<ZoneParking> getAllParkingArea(){
		return zoneParkingService.getAllParkingArea();
	}
}
